package com.atguigu.eduorder.utils;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class ZfbPayUtils implements InitializingBean {

    @Value("${appid}")
    private String appId;

    @Value("${privateKey}")
    private String privateKey;

    @Value("${publicKey}")
    private String publicKey;

    //服务器异步通知页面路径
    @Value("${notifyUrl}")
    private String notifyUrl;

    //页面跳转同步通知页面路径
    @Value("${returnUrl}")
    private String returnUrl;

    //签名方式
    @Value("${signType}")
    private String signType;

    //字符编码格式
    @Value("${charset}")
    private String charset;

    //支付宝网关
    @Value("${gatewayUrl}")
    private String gatewayUrl;

    public static String AppId;
    public static String PrivateKey;
    public static String PublicKey;
    public static String NotifyUrl;
    public static String ReturnUrl;
    public static String SignType;
    public static String Charset;
    public static String GatewayUrl;

    @Override
    public void afterPropertiesSet() throws Exception {
        AppId = appId;
        PrivateKey = privateKey;
        PublicKey = publicKey;
        NotifyUrl = notifyUrl;
        ReturnUrl = returnUrl;
        SignType = signType;
        Charset = charset;
        GatewayUrl = gatewayUrl;
    }
}
